package com.mew.lobby.handler.gameconf;

import com.mew.common.rest.bo.MewSession;
import com.mew.lobby.annotation.LobbyHandler;
import com.mew.lobby.message.request.DownloadGameRequestMessage;
import com.mew.lobby.net.LobbyHandlerMapCmdType;
import com.mew.lobby.net.MewHandler;
import com.zebra.remoting.protocol.ZebraCommand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author King.Song
 * @Date 2020/11/14 0014
 **/
@Service
@Slf4j
@LobbyHandler(LobbyHandlerMapCmdType.Download)
public class DownloadGameHandler implements MewHandler<DownloadGameRequestMessage> {

    @Autowired
    private CommonFeignService commonFeignService;

    @Override
    public void handle(ZebraCommand<DownloadGameRequestMessage> zebraCommand, MewSession session) {
        DownloadGameRequestMessage message = zebraCommand.getRequest();
        log.info("down info {}", message);
        commonFeignService.downloadGme(zebraCommand.getUserId(), message.getGameId(), message.getDownType());
        zebraCommand.sendSuccessMsg();
    }

}
